package org.kjtc.controller;

import org.kjtc.entity.Log;
import org.kjtc.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class LogController {

    @Autowired
    private LogService logService;

    @RequestMapping(value = "/getLogMessage")
    public Map<String,Object> getLogMessage(Log log){
        Map<String,Object> logMap = new HashMap<String, Object>();
        List<Log> logList = null;
        try{
            logList = logService.getLogMessage(log);
            logMap.put("state","Success");
        }catch (Exception e){
            e.printStackTrace();
            logMap.put("state","Error");
            logMap.put("message","获取操作日志失败");
        }
        logMap.put("logList",logList);
        return logMap;
    }
}
